<template>
	<view class="message">
		<view class="message-item">
			<view class="message-tag">
				任务名称：
			</view>
			<view class="message-value">
				{{message.name}}
			</view>
		</view>
		<view class="message-item">
			<view class="message-tag">
				任务优先级：
			</view>
			<view class="message-value">
				{{message.priorityText}}
			</view>
		</view>
		<view class="message-item">
			<view class="message-tag">
				任务负责人：
			</view>
			<view class="message-value">
				{{message.ownerUserName}}
			</view>
		</view>
		<view class="message-item">
			<view class="message-tag">
				任务参与人：
			</view>
			<view class="message-value">
				XXXX
			</view>
		</view>
		<view class="message-item">
			<view class="message-tag">
				任务截止时间：
			</view>
			<view class="message-value">
				{{$share.getDate(message.deadLine)}}
			</view>
		</view>
		<view class="message-item">
			<view class="message-tag" style="color: #101010;">
				任务详细说明：
			</view>
			<view class="message-value">
				{{message.description}}
			</view>
		</view>
		<view class="message-item">
			<view class="message-tag">
				创建人：
			</view>
			<view class="message-value">
				{{message.creatorName}}
			</view>
		</view>
		<view class="message-item">
			<view class="message-tag">
				创建时间：
			</view>
			<view class="message-value">
				{{$share.getDate(message.createTime)}}
			</view>
		</view>
		<view class="task-data" v-if="message.fileUrls.length > 0">
			<view class="message-tag">
				任务资料：
			</view>
			<view class="message-value">
				<view class="data" v-for="(item, index) in message.fileUrls"  @click="openFile(item)">
					{{index + 1}}.{{item.split('.').pop()}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			message: Object
		},
		methods: {
			// 预览文件
			openFile(file){
				console.log(this.$share.isImg(file))
				if(this.$share.isImg(file)){
					let urls = [];
					urls[0] = file
					uni.previewImage({
						urls: urls
					})
				}else{
					this.$share.openFile(file);
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "@/common/style/customicons.scss";
	.message{
		// width: 100%;
		.message-item{
			@include flex-r-wrap;
			// padding: 20rpx 0;
			line-height: 68rpx;
			font-size: 28rpx;
			.message-tag{
				color: #9A9A9A;
			}
			.message-value{
				color: #101010;
			}
		}
		.task-data{
			padding: 20rpx 0;
			font-size: 28rpx;
			color: #101010;
			.message-value{
				padding: 20rpx 0 0;
				.data{
					background-color: #F3F6F9;
					height: 52rpx;
					text-align: center;
					line-height: 52rpx;
					border-radius: 6rpx;
					margin: 0 0 20rpx;
				}
			}
		}
	}
</style>